package com.scy.boot05.mapper;

import com.scy.boot05.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

//    用过用户名作为查询条件，查询id,如果有数据userinfo会返回一个id,没有则会返回null;
    @Select("select password from userinfo where username=#{username}")
    User selectByUsername(String username);

    @Insert("insert into userinfo values(null,#{username},#{password},#{nickname},#{age})")
    void insert(User user);
}
